import {
  Column,
  CreateDateColumn,
  Entity,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity({ name: 'tb_departments' })
export class Department {
  @PrimaryGeneratedColumn({
    type: 'int',
    name: 'department_id',
    comment: '部门ID',
  })
  department_id: number;

  @Column({
    name: 'department_code',
    type: 'varchar',
    length: 128,
    comment: '部门Code',
  })
  departmentCode: string;

  @Column({
    name: 'department_name',
    type: 'varchar',
    length: 128,
    comment: '部门名称',
  })
  departmentName: string;

  @Column({
    name: 'department_short_name',
    type: 'varchar',
    length: 64,
    comment: '部门简称',
  })
  departmentShortName: string;

  @Column({
    name: 'user_id',
    type: 'varchar',
    length: 36,
    nullable: true,
    comment: '用户ID，是uuid',
  })
  userId: string;

  @UpdateDateColumn({
    name: 'updated_at',
    type: 'timestamp',
    comment: '最后一次更新时间',
  })
  updated_at: number;

  @CreateDateColumn({
    name: 'created_at',
    type: 'timestamp',
    comment: '创建时间',
  })
  created_at: number;
}
